#include "cmsis_os.h"
#include "FreeRTOS.h"
#include "stdint.h"
#include "stdlib.h"
#include "math.h"
#include "bsp_dwt.h"

//定义代码类型融合切换不同代码，切换后需重新编译生成

// #pragma message "check robot def"
// #define GIMBAL_BOARD_DOWN
// #define GIMBAL_BOARD_UP
#define CHASSIS_BOARD

//robot 尺寸信息
#define Wheel_R				0.07625f






#define fp32    float
#define PI      3.1415926f 
//单位转换宏定义 
#define radian2coder 			(double)1303.80 			//弧度到编码器 radian2coder = 8192/2*pi
#define angle2coder 			(double)22.76		        //角度到编码器 angle2coder = 8192/360
#define coder2radian            (double)0.00076699		    //编码器到弧度 coder2radian = 2*pi/8192
#define coder2angle				(double)2.02197265		    //编码器到角度 coder2angle = 360/8192
#define angle2radian            (double)0.01744445          //角度到弧度   angle2radian = 2*pi/360
#define radian2angle            (double)57.29582            //弧度转角度

//编码器云台启动标定值
#define PITCH_UPLIMIT_UP  
#define PITCH_DOWNLIMIT_UP 

#define PITCH_UPLIMIT_UP  
#define PITCH_DOWNLIMIT_UP 


/*任务模式列表*/
#define	PATROL_MODE                         1   				 //巡逻模式
#define	REMOTE_MODE				            2     				//遥控模式
#define	AUTO_AIM_MODE				        3  					//自瞄模式(反陀螺+自瞄)


/*任务周期列表*/
#define	Gimbal_control_Period   2
#define	Shoot_control_Period    3
#define	Offline_Check_Period    150
#define	Space_Calc_Period       1
#define	friction_Period         3
#define	trigger_Period          2
#define	Chassis_control_Period  3



#define Friction_TIM 	htim8


/*任务句柄外部变量声明*/

extern osThreadId Offline_TaskHandle;
extern osThreadId INS_TaskHandle;
extern osThreadId Gimbal_control_TaskHandle;
extern osThreadId Friction_TaskHandle;											
extern osThreadId Trigger_TaskHandle;					
extern osThreadId gimbal_init_TaskHandle;

extern osThreadId DatatxTaskHandle;                 //发送数据任务	
extern osThreadId RemoteTaskHandle;					//遥控器任务句柄
extern osThreadId Chassis_TaskHandle;				//底盘控制任务句柄s